<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link href="<%=request.getContextPath()%>/css/global.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath() %>/js/easyui/themes/metro/easyui.css" type="text/css" rel="stylesheet"/>
<link href="<%=request.getContextPath() %>/js/date/skin/WdatePicker.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/global.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/easyui/easyui.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/date/WdatePicker.js"></script>
<script type="text/javascript">

$(function(){

	$("#dataTable").datagrid({
		toolbar: '#dataSearch',
		fitColumns:true,
		striped: true, 
		singleSelect:false,
		pagination:true,
		rownumbers:true,
		SelectOnCheck:true,
		CheckOnSelect:true,
        onSelect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onSelectAll: function(rows){
        	var nos="";
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselectAll: function(rows){
			$("#keys").val("");
    	}
	});
	
	$('#dataTable').datagrid('getPager').pagination({
		total:<s:property value="pageInfo.pageRecord"/>,
		pageNumber:<s:property value="pageInfo.pageIndex"/>,
		pageSize:<s:property value="pageInfo.pageSize"/>,
		pageList: [20,50,100] ,
		onSelectPage:function(pageNumber,pageSize){  
			toPage(pageNumber,pageSize);
		},
		onRefresh:function(pageNumber,pageSize){  
			location.reload();
		}
	});
	
});

</script>
</head>
<body >
<div id="dataSearch" >    
<form id="sform" action="currency_list.html" method="get" enctype="multipart/form-data">
<table style="width: 100%;">
<tr>
<td height="30" >
		<input type="hidden"  id="keys" name="keys"  value=""/>
		<input type="button" class="submit" value="新增记录" onclick="location.href='<%=request.getContextPath()%>/currency_edit.html'"/>
		<input type="button" class="submit" value="批量更新" onclick="location.href='<%=request.getContextPath()%>/currency_savebatch.html?curNos='+$('#keys').val()"/>
		<input type="button" class="submit"   value="导出数据"  onclick="if(confirm('确认要执行导出操作吗?')){window.open(location.href.replace('list','export'));}"/>
		&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" class="submit" value="货币编号" onclick="toSort('sortField','curNo')"/>
		<input type="button" class="submit" value="更新日期" onclick="toSort('sortField','curDate')"/>
		
		&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" class="submit" value="升序排列" onclick="toSort('sortOrder','true')"/>
		<input type="button" class="submit" value="降序排列" onclick="toSort('sortOrder','false')"/>
</td>
</tr>
</table>
</form>
</div>

<table id="dataTable" style="width: 100%;" class="easyui-datagrid" >
<thead>
<tr>
<th data-options="field:'ck'" checkbox="true"></th>
<th data-options="field:'curNo', width:'10%',align:'left' , halign: 'left'">货币编号</th>
<th data-options="field:'curName', width:'15%',align:'left' , halign: 'left'">货币名称</th>
<th data-options="field:'curRate', width:'15%',align:'left' , halign: 'left'">汇率</th>
<th data-options="field:'op', width:'100',align:'left' , halign: 'left'">手动更新</th>
<th data-options="field:'curState', width:'8%',align:'left' , halign: 'left'">是否可用</th>
<th data-options="field:'curDate', width:'15%',align:'left' , halign: 'left'">日期</th>
<th data-options="field:'curRemark', width:'10%',align:'left' , halign: 'left'">备注</th>

</tr>
</thead>
<tbody>
<s:iterator value="currencyList" id="show" status="seq">
<tr>
<td><s:property value="#show.curNo"/></td>
<td><s:property value="#show.curNo"/></td>
<td><s:property value="#show.curName"/></td>
<td><s:text name="global.format.currency"><s:param value="#show.curRate"/></s:text></td>
<td>
<form id="sform" action="currency_saverate.html" method="post" enctype="multipart/form-data">
<input type="hidden" placeholder="编号" name="curNo" id="curNo" value="<s:property value="#show.curNo"/>" />
<input type="text" placeholder="汇率" name="curRate" id="curRate" value="<s:if test="#show.curRate!=null"><s:text name="global.format.currency"><s:param value="#show.curRate"/></s:text></s:if>" onkeyup="value=value.replace(/[^\d\.]/g,'')" />
<input type="submit" value="更新" style="width: 50px;"class="submit"/>
</form>
</td>
<td><s:if test="#show.curState==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
<td><s:text name="global.format.dateminute"><s:param value="#show.curDate"/></s:text>
<td><s:property value="#show.curRemark"/></td>

</tr>
</s:iterator>
</tbody>
</table>
<br/>
<br/>
<br/>
</body>
</html>
